package com.xiaojun.whut.Controller.App;

//import com.xiaojun.cdutspspringboot.repository.CardMessageRepository;
import com.xiaojun.whut.Entity.CardMessage;
import com.xiaojun.whut.Service.CardService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Api(tags = "app用户数据接口")
@RequestMapping(path = "/app/card/")
public class AppCardController {
    @Autowired
    private CardService cardService;

    @PostMapping(path = "save")
    public Object saveCardMessage(@RequestBody CardMessage cardMessage){
        System.out.println(cardMessage.toString());
        return cardService.save(cardMessage);
    }
    @GetMapping(path = "all")
    public List<CardMessage> findAllCard(){
        return cardService.findAll();
    }

    @PostMapping(path = "update")
    public Object updateCardMessage(@RequestBody String body){
        return cardService.update(body);
    }
    @DeleteMapping("delete/{id}")
    public Object deleteCardMessage(@PathVariable("id") int id){
        return cardService.delete(id);
    }
}
